<script setup>
import axios from "axios";
import {ref, watch} from "vue";
import RecommendContent from "@/components/Recommend/RecommendContent.vue";

const props = defineProps({
  Search: String
})

const list = ref([])

watch(() => props.Search, async (text) => {
  list.value = (await axios.get("http://127.0.0.1:8081/art/getArticleBySearch", {
    params: {
      search: text
    }
  })).data
  console.log(text)
}, {immediate: true})

</script>

<template>
  <div class = "border">
    <div v-for = "(list,index) in list" :key = "index">
      <RecommendContent class = "RecommendContent" :title = "list.title" :id = "list.id"
                        :comment-num = "list.commentNum" :user = "list.user" :content = "list.content"
                        :like-count = "list.likeCount" :get-list = "list.getList"></RecommendContent>
    </div>
  </div>
</template>

<style scoped>

</style>